package com.zzyy.study.sample;

/**
 * @auther zzyy
 * @create 2024-07-05 15:21
 */
public class UserControllerSample
{

    /**
     @Resource
     private UserService userService;

     @PostMapping(value = "/user/add")
     public ResultData<Integer> addUser(@RequestBody User user)
     {
     int retValue = userService.addUser(user);
     return ResultData.success(retValue);
     }

     @PostMapping(value = "/user/del/{id}")
     public ResultData<Integer> delUser(@PathVariable("id") Integer id)
     {
     int retValue = userService.delUser(id);
     return ResultData.success(retValue);
     }

     @PostMapping(value = "/user/update")
     public ResultData<Integer> updateUser(@RequestBody UserDTO userDTO)
     {
     User user = new User();

     BeanUtils.copyProperties(userDTO,user);

     int retValue =  userService.updateUser(user);
     return ResultData.success(retValue);
     }

     @GetMapping(value = "/user/get/{id}")
     public ResultData<User> getUserById(@PathVariable("id") Integer id)
     {
     int age = 10/0;
     return ResultData.success(userService.getUserById(id));
     }

     @GetMapping(value = "/user/list")
     public ResultData<List<User>> getAll()
     {
     return ResultData.success(userService.getAll());
     }
     */
}
